﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.EnterpriseLibrary.Data;
using System.Data.Common;
using NLBS.Entity;
using System.Data;

namespace NLBS.Data
{
    public partial class NHibernateDataProvider : DbProvider
    {
        #region smile

        public override IList<Smile> GetSmile()
        {
            return CurrentSession.CreateCriteria(typeof(Smile)).List<Smile>();
        }

        public override Smile GetSmileByID(int smID)
        {
            return CurrentSession.Load<Smile>(smID);
          
           
        }

        public override int InsertSmile(Smile sm)
        {
            CurrentSession.Save(sm);
            CurrentSession.Flush();
            return 1;
        }

        public override void UpdateSmile(Smile sm)
        {
            CurrentSession.SaveOrUpdate(sm);
            CurrentSession.Flush();
        }

        public override void DeleteSmile(int smID)
        {
            CurrentSession.Delete(GetSmileByID(smID));
            CurrentSession.Flush();
        }

        #endregion
    }
}
